package cn.jsj.dispose;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 修改律师助理信息处理类
 * @author LI
 *
 */
 public class ModifyAssistInfo extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
	 public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// 调试信息
		 cn.jsj.utils.SysLogger.PrintInfo("修改律师助理信息！！！");

		 //新建律师助理对象
		 cn.jsj.pojo.TblLawyAssistant tla=new cn.jsj.pojo.TblLawyAssistant();

		 //赋值
		 tla.setBirthTime(cn.jsj.utils.TimeDispose.transferDate(request.getParameter("massistbirthtime").trim()));
		 tla.setLawAssisId(Integer.parseInt(request.getParameter("massistid").trim()));
		 tla.setEducationalLevel(request.getParameter("massistedulevel").trim());
		 tla.setGraduateSchool(request.getParameter("massistgradschool").trim());
		 //根据指导老师姓名获取指导老师ID
		 cn.jsj.dao.TblLawyerDAO tld=new cn.jsj.dao.TblLawyerDAO();
		 int lawyerId=tld.getLawyerId(request.getParameter("massistteacher").trim());
		 tla.setGuidTeacher(lawyerId);
		  tla.setIdentityNumber(request.getParameter("massistidennumb").trim());
		  tla.setLawAgreement(Integer.parseInt(request.getParameter("assistagreement").trim()));
		  tla.setLawAssisEmail(request.getParameter("massistemail").trim());
		  tla.setLawAssisName(request.getParameter("massistname").trim());
		  tla.setLawAssisPhone(request.getParameter("massistphone").trim());
		  tla.setLawAssisSex(request.getParameter("massistsex").trim());
		  tla.setPoliticalStatus(request.getParameter("massistpstatus").trim());
		  tla.setPracticeNumber(request.getParameter("massistpranumb").trim());



		  //新增的属性
		  tla.setStartTime(cn.jsj.utils.TimeDispose.transferDate(request.getParameter("massiststarttime").trim()));
		  tla.setEndTime(cn.jsj.utils.TimeDispose.transferDate(request.getParameter("massistendtime").trim()));
		  tla.setFrontOccupation(request.getParameter("massistfrontoccupation").trim());
		  tla.setArchiveAddr(request.getParameter("massistarchive").trim());
		  tla.setHouseholeAddr(request.getParameter("massisthousehold").trim());
		  tla.setEligibleNumb(request.getParameter("massisteligible").trim());
		  //调试信息
		  cn.jsj.utils.SysLogger.PrintInfo("赋值完成");
		  System.out.println("   "+request.getParameter("massistbirthtime")+"   "+request.getParameter("massistname"));
		  System.out.println("  "+"   "+tla.getEducationalLevel()+"  "+tla.getGraduateSchool()+"   "+tla.getIdentityNumber()+"   "+tla.getLawAssisEmail()+    "   "+tla.getLawAssisName()+"    "+tla.getLawAssisPhone()+"    "+tla.getLawAssisSex()+  "   "+tla.getPoliticalStatus()+"    "+tla.getPracticeNumber()+"    "+tla.getLawAgreement()+"   "+tla.getLawAssisId()+"   "+tla.getGuidTeacher());

		  //更新律师助理对象
		  cn.jsj.dao.TblLawyAssistantDAO tlad=new cn.jsj.dao.TblLawyAssistantDAO();
		  int updateResult=tlad.updateLawyerAssist(tla);

		//输出流
			 java.io.PrintWriter out=response.getWriter();
			 if(updateResult==1){
				 out.println("{message:'更新成功！'}");
			 }else{
				 out.println("{message:'更新失败！'}");
			 }
			 out.flush();
			 out.close();
	}
}